import Vue from 'vue'
// 引入下载下来的路由构造函数
import Router from 'vue-router'
import Home from './views/Home.vue'
import Login from './views/Login.vue'

// 启用路由插件
Vue.use(Router)

// 创建路由实例
export default new Router({
  routes: [{
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    name: 'home',
    component: Home,
    redirect: { name: 'welcome' },
    children: [
      {
        path: 'welcome',
        name: 'welcome',
        component: () =>
                import(/* webpackChunkName: "welcome" */ './views/Welcome.vue')
      },
      {
        path: 'users',
        name: 'users',
        component: () =>
                import(/* webpackChunkName: "users" */ './views/Users.vue')
      },
      {
        path: 'rights',
        name: 'rights',
        component: () =>
                import(/* webpackChunkName: "rights" */ './views/auth/RightList.vue')
      },
      {
        path: 'roles',
        name: 'roles',
        component: () =>
                import(/* webpackChunkName: "roles" */ './views/auth/Roles.vue')
      },
      {
        path: 'categories',
        name: 'categories',
        component: () =>
                import(/* webpackChunkName: "categories" */ './views/goods/Cate.vue')
      },
      {
        path: 'goods',
        name: 'goods',
        component: () =>
                import(/* webpackChunkName: "goods" */ './views/goods/GoodList.vue')
      },
      {
        path: 'goodadd',
        name: 'goodadd',
        component: () =>
                import(/* webpackChunkName: "goodadd" */ './views/goods/GoodList.vue')
      },
      {
        path: 'orders',
        name: 'orders',
        component: () =>
                import(/* webpackChunkName: "orders" */ './views/goods/Test.vue')
      }
    ]
  }
  ]
})
